package com.jkm.controller;

import com.jkm.domain.User;
import com.jkm.service.UserService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    @Autowired
    private UserService userService;

//    @Test
//    public void getUser(){
//        User user = userService.selectByPrimaryKey(1L);
//        System.out.println(user);
//    }

    @RequestMapping("/get")
    @ResponseBody
    public void get(){
        User user = userService.selectByPrimaryKey(1L);
        System.out.println(user);
    }

    @RequestMapping("/insert")
    @ResponseBody
    public void insert(){
        User user = new User();
        user.setAge(1001);
        user.setName("kk");
        userService.insert(user);
    }
}
